package com.example.administrator.x2picturetransliteration.Home.Presenter.Activity;

import android.content.Context;

import com.example.administrator.x2picturetransliteration.Base.BasePresenter;
import com.example.administrator.x2picturetransliteration.Base.HttpGo;
import com.example.administrator.x2picturetransliteration.Bean.HttpDataBean;

import java.util.HashMap;
import java.util.Map;

import rx.subscriptions.CompositeSubscription;

/**
 * 常见问题详情
 * Created by Administrator on 2019/9/9.
 */

public class CommonProblemDetailsPresenter extends BasePresenter{

    public CommonProblemDetailsPresenter(Context context, CompositeSubscription mCompositeSubscription) {
        super(context, mCompositeSubscription);
    }

    public void get(String id, final Callback mCallback){

        final Map<String,String> httpdata = new HashMap<>();
        httpdata.put("id",id);

        mCompositeSubscription.add(

                mHttpGo.postSubscription("sys_question/get", httpdata, new HttpGo.HttpGoCallback() {
                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onNext(HttpDataBean httpDataBean) {

                        if (httpDataBean.getCode()==0){

                            if (httpDataBean.getData()!=null)mCallback.getData(httpDataBean.getData());
                        }
                    }
                })
        );

    }

}
